home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / sspi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  38.1 KB  |  1,138 lines

  1. /*++
  2.  
  3. Copyright (c) 1992-1998 Microsoft Corporation
  4.  
  5. Module Name: sspi.h
  6.  
  7. Purpose: Security support provider interface structures and prototypes.
  8.  
  9. --*/
  10.  
  11. #ifndef __SSPI_H__
  12. #define __SSPI_H__
  13.  
  14. //
  15. // For NT-2 and up, wtypes will define HRESULT to be long.
  16. //
  17.  
  18. typedef WCHAR SEC_WCHAR;
  19. typedef CHAR SEC_CHAR;
  20.  
  21. typedef LONG SECURITY_STATUS;
  22.  
  23. #define SEC_TEXT TEXT
  24. #define SEC_FAR
  25. #define SEC_ENTRY WINAPI
  26.  
  27. #ifdef UNICODE
  28. typedef SEC_WCHAR SEC_FAR * SECURITY_PSTR;
  29. typedef CONST SEC_WCHAR SEC_FAR * SECURITY_PCSTR;
  30. #else // UNICODE
  31. typedef SEC_CHAR SEC_FAR * SECURITY_PSTR;
  32. typedef CONST SEC_CHAR SEC_FAR * SECURITY_PCSTR;
  33. #endif // UNICODE
  34.  
  35. //
  36. // Okay, security specific types:
  37. //
  38.  
  39. typedef struct _SecHandle
  40. {
  41.     unsigned long dwLower;
  42.     unsigned long dwUpper;
  43. } SecHandle, SEC_FAR * PSecHandle;
  44.  
  45. typedef SecHandle CredHandle;
  46. typedef PSecHandle PCredHandle;
  47.  
  48. typedef SecHandle CtxtHandle;
  49. typedef PSecHandle PCtxtHandle;
  50.  
  51. typedef LARGE_INTEGER _SECURITY_INTEGER, SECURITY_INTEGER, *PSECURITY_INTEGER;
  52.  
  53. #ifdef SCHANNEL_BUG
  54. typedef SECURITY_INTEGER TimeStamp;
  55. typedef PSECURITY_INTEGER PTimeStamp;
  56. #else
  57. typedef unsigned long TimeStamp;
  58. typedef unsigned long SEC_FAR * PTimeStamp;
  59. #endif
  60.  
  61. //
  62. // If we are in 32 bit mode, define the SECURITY_STRING structure,
  63. // as a clone of the base UNICODE_STRING structure.  This is used
  64. // internally in security components, an as the string interface
  65. // for kernel components (e.g. FSPs)
  66. //
  67.  
  68. typedef struct _SECURITY_STRING {
  69.     unsigned short      Length;
  70.     unsigned short      MaximumLength;
  71.     unsigned short *    Buffer;
  72. } SECURITY_STRING, * PSECURITY_STRING;
  73.  
  74. //
  75. // SecPkgInfo structure
  76. //
  77. //  Provides general information about a security provider
  78. //
  79.  
  80. typedef struct _SecPkgInfoW
  81. {
  82.     unsigned long fCapabilities;        // Capability bitmask
  83.     unsigned short wVersion;            // Version of driver
  84.     unsigned short wRPCID;              // ID for RPC Runtime
  85.     unsigned long cbMaxToken;           // Size of authentication token (max)
  86.     SEC_WCHAR SEC_FAR * Name;           // Text name
  87.     SEC_WCHAR SEC_FAR * Comment;        // Comment
  88. } SecPkgInfoW, SEC_FAR * PSecPkgInfoW;
  89.  
  90. typedef struct _SecPkgInfoA
  91. {
  92.     unsigned long fCapabilities;        // Capability bitmask
  93.     unsigned short wVersion;            // Version of driver
  94.     unsigned short wRPCID;              // ID for RPC Runtime
  95.     unsigned long cbMaxToken;           // Size of authentication token (max)
  96.     SEC_CHAR SEC_FAR * Name;            // Text name
  97.     SEC_CHAR SEC_FAR * Comment;         // Comment
  98. } SecPkgInfoA, SEC_FAR * PSecPkgInfoA;
  99.  
  100. #ifdef UNICODE
  101. #define SecPkgInfo SecPkgInfoW
  102. #define PSecPkgInfo PSecPkgInfoW
  103. #else
  104. #define SecPkgInfo SecPkgInfoA
  105. #define PSecPkgInfo PSecPkgInfoA
  106. #endif // !UNICODE
  107.  
  108. //
  109. //  Security Package Capabilities
  110. //
  111. #define SECPKG_FLAG_INTEGRITY       0x00000001  // Supports integrity on messages
  112. #define SECPKG_FLAG_PRIVACY         0x00000002  // Supports privacy (confidentiality)
  113. #define SECPKG_FLAG_TOKEN_ONLY      0x00000004  // Only security token needed
  114. #define SECPKG_FLAG_DATAGRAM        0x00000008  // Datagram RPC support
  115. #define SECPKG_FLAG_CONNECTION      0x00000010  // Connection oriented RPC support
  116. #define SECPKG_FLAG_MULTI_REQUIRED  0x00000020  // Full 3-leg required for re-auth.
  117. #define SECPKG_FLAG_CLIENT_ONLY     0x00000040  // Server side functionality not available
  118. #define SECPKG_FLAG_EXTENDED_ERROR  0x00000080  // Supports extended error msgs
  119. #define SECPKG_FLAG_IMPERSONATION   0x00000100  // Supports impersonation
  120. #define SECPKG_FLAG_ACCEPT_WIN32_NAME   0x00000200  // Accepts Win32 names
  121. #define SECPKG_FLAG_STREAM          0x00000400  // Supports stream semantics
  122. #define SECPKG_FLAG_NEGOTIABLE      0x00000800  // Can be used by the negotiate package
  123. #define SECPKG_FLAG_GSS_COMPATIBLE  0x00001000  // GSS Compatibility Available
  124. #define SECPKG_FLAG_LOGON           0x00002000  // Supports common LsaLogonUser
  125.  
  126. #define SECPKG_ID_NONE      0xFFFF
  127.  
  128. //
  129. // SecBuffer
  130. //
  131. //  Generic memory descriptors for buffers passed in to the security
  132. //  API
  133. //
  134.  
  135. typedef struct _SecBuffer {
  136.     unsigned long cbBuffer;             // Size of the buffer, in bytes
  137.     unsigned long BufferType;           // Type of the buffer (below)
  138.     void SEC_FAR * pvBuffer;            // Pointer to the buffer
  139. } SecBuffer, SEC_FAR * PSecBuffer;
  140.  
  141. typedef struct _SecBufferDesc {
  142.     unsigned long ulVersion;            // Version number
  143.     unsigned long cBuffers;             // Number of buffers
  144.     PSecBuffer pBuffers;                // Pointer to array of buffers
  145. } SecBufferDesc, SEC_FAR * PSecBufferDesc;
  146.  
  147. #define SECBUFFER_VERSION           0
  148.  
  149. #define SECBUFFER_EMPTY             0   // Undefined, replaced by provider
  150. #define SECBUFFER_DATA              1   // Packet data
  151. #define SECBUFFER_TOKEN             2   // Security token
  152. #define SECBUFFER_PKG_PARAMS        3   // Package specific parameters
  153. #define SECBUFFER_MISSING           4   // Missing Data indicator
  154. #define SECBUFFER_EXTRA             5   // Extra data
  155. #define SECBUFFER_STREAM_TRAILER    6   // Security Trailer
  156. #define SECBUFFER_STREAM_HEADER     7   // Security Header
  157. #define SECBUFFER_NEGOTIATION_INFO  8   // Hints from the negotiation pkg
  158.  
  159. #define SECBUFFER_ATTRMASK          0xF0000000
  160. #define SECBUFFER_READONLY          0x80000000  // Buffer is read-only
  161. #define SECBUFFER_RESERVED          0x40000000
  162.  
  163. typedef struct _SEC_NEGOTIATION_INFO {
  164.     unsigned long       Size;           // Size of this structure
  165.     unsigned long       NameLength;     // Length of name hint
  166.     SEC_WCHAR SEC_FAR * Name;           // Name hint
  167.     void SEC_FAR *      Reserved;       // Reserved
  168. } SEC_NEGOTIATION_INFO, SEC_FAR * PSEC_NEGOTIATION_INFO ;
  169.  
  170. //
  171. //  Data Representation Constant:
  172. //
  173. #define SECURITY_NATIVE_DREP        0x00000010
  174. #define SECURITY_NETWORK_DREP       0x00000000
  175.  
  176. //
  177. //  Credential Use Flags
  178. //
  179. #define SECPKG_CRED_INBOUND         0x00000001
  180. #define SECPKG_CRED_OUTBOUND        0x00000002
  181. #define SECPKG_CRED_BOTH            0x00000003
  182.  
  183. //
  184. //  InitializeSecurityContext Requirement and return flags:
  185. //
  186.  
  187. #define ISC_REQ_DELEGATE                0x00000001
  188. #define ISC_REQ_MUTUAL_AUTH             0x00000002
  189. #define ISC_REQ_REPLAY_DETECT           0x00000004
  190. #define ISC_REQ_SEQUENCE_DETECT         0x00000008
  191. #define ISC_REQ_CONFIDENTIALITY         0x00000010
  192. #define ISC_REQ_USE_SESSION_KEY         0x00000020
  193. #define ISC_REQ_PROMPT_FOR_CREDS        0x00000040
  194. #define ISC_REQ_USE_SUPPLIED_CREDS      0x00000080
  195. #define ISC_REQ_ALLOCATE_MEMORY         0x00000100
  196. #define ISC_REQ_USE_DCE_STYLE           0x00000200
  197. #define ISC_REQ_DATAGRAM                0x00000400
  198. #define ISC_REQ_CONNECTION              0x00000800
  199. #define ISC_REQ_CALL_LEVEL              0x00001000
  200. #define ISC_REQ_EXTENDED_ERROR          0x00004000
  201. #define ISC_REQ_STREAM                  0x00008000
  202. #define ISC_REQ_INTEGRITY               0x00010000
  203. #define ISC_REQ_IDENTIFY                0x00020000
  204.  
  205. #define ISC_RET_DELEGATE                0x00000001
  206. #define ISC_RET_MUTUAL_AUTH             0x00000002
  207. #define ISC_RET_REPLAY_DETECT           0x00000004
  208. #define ISC_RET_SEQUENCE_DETECT         0x00000008
  209. #define ISC_RET_CONFIDENTIALITY         0x00000010
  210. #define ISC_RET_USE_SESSION_KEY         0x00000020
  211. #define ISC_RET_USED_COLLECTED_CREDS    0x00000040
  212. #define ISC_RET_USED_SUPPLIED_CREDS     0x00000080
  213. #define ISC_RET_ALLOCATED_MEMORY        0x00000100
  214. #define ISC_RET_USED_DCE_STYLE          0x00000200
  215. #define ISC_RET_DATAGRAM                0x00000400
  216. #define ISC_RET_CONNECTION              0x00000800
  217. #define ISC_RET_INTERMEDIATE_RETURN     0x00001000
  218. #define ISC_RET_CALL_LEVEL              0x00002000
  219. #define ISC_RET_EXTENDED_ERROR          0x00004000
  220. #define ISC_RET_STREAM                  0x00008000
  221. #define ISC_RET_INTEGRITY               0x00010000
  222. #define ISC_RET_IDENTIFY                0x00020000
  223.  
  224. #define ASC_REQ_DELEGATE                0x00000001
  225. #define ASC_REQ_MUTUAL_AUTH             0x00000002
  226. #define ASC_REQ_REPLAY_DETECT           0x00000004
  227. #define ASC_REQ_SEQUENCE_DETECT         0x00000008
  228. #define ASC_REQ_CONFIDENTIALITY         0x00000010
  229. #define ASC_REQ_USE_SESSION_KEY         0x00000020
  230. #define ASC_REQ_ALLOCATE_MEMORY         0x00000100
  231. #define ASC_REQ_USE_DCE_STYLE           0x00000200
  232. #define ASC_REQ_DATAGRAM                0x00000400
  233. #define ASC_REQ_CONNECTION              0x00000800
  234. #define ASC_REQ_CALL_LEVEL              0x00001000
  235. #define ASC_REQ_EXTENDED_ERROR          0x00008000
  236. #define ASC_REQ_STREAM                  0x00010000
  237. #define ASC_REQ_INTEGRITY               0x00020000
  238. #define ASC_REQ_LICENSING               0x00040000
  239. #define ASC_REQ_IDENTIFY                0x00080000
  240.  
  241.  
  242. #define ASC_RET_DELEGATE                0x00000001
  243. #define ASC_RET_MUTUAL_AUTH             0x00000002
  244. #define ASC_RET_REPLAY_DETECT           0x00000004
  245. #define ASC_RET_SEQUENCE_DETECT         0x00000008
  246. #define ASC_RET_CONFIDENTIALITY         0x00000010
  247. #define ASC_RET_USE_SESSION_KEY         0x00000020
  248. #define ASC_RET_ALLOCATED_MEMORY        0x00000100
  249. #define ASC_RET_USED_DCE_STYLE          0x00000200
  250. #define ASC_RET_DATAGRAM                0x00000400
  251. #define ASC_RET_CONNECTION              0x00000800
  252. #define ASC_RET_CALL_LEVEL              0x00002000 // skipped 1000 to be like ISC_
  253. #define ASC_RET_THIRD_LEG_FAILED        0x00004000
  254. #define ASC_RET_EXTENDED_ERROR          0x00008000
  255. #define ASC_RET_STREAM                  0x00010000
  256. #define ASC_RET_INTEGRITY               0x00020000
  257. #define ASC_RET_LICENSING               0x00040000
  258. #define ASC_RET_IDENTIFY                0x00080000
  259.  
  260. //
  261. //  Security Credentials Attributes:
  262. //
  263.  
  264. #define SECPKG_CRED_ATTR_NAMES 1
  265.  
  266. typedef struct _SecPkgCredentials_NamesW
  267. {
  268.     SEC_WCHAR SEC_FAR * sUserName;
  269. } SecPkgCredentials_NamesW, SEC_FAR * PSecPkgCredentials_NamesW;
  270.  
  271. typedef struct _SecPkgCredentials_NamesA
  272. {
  273.     SEC_CHAR SEC_FAR * sUserName;
  274. } SecPkgCredentials_NamesA, SEC_FAR * PSecPkgCredentials_NamesA;
  275.  
  276. #ifdef UNICODE
  277. #define SecPkgCredentials_Names SecPkgCredentials_NamesW
  278. #define PSecPkgCredentials_Names PSecPkgCredentials_NamesW
  279. #else
  280. #define SecPkgCredentials_Names SecPkgCredentials_NamesA
  281. #define PSecPkgCredentials_Names PSecPkgCredentials_NamesA
  282. #endif // !UNICODE
  283.  
  284. //
  285. //  Security Context Attributes:
  286. //
  287.  
  288. #define SECPKG_ATTR_SIZES           0
  289. #define SECPKG_ATTR_NAMES           1
  290. #define SECPKG_ATTR_LIFESPAN        2
  291. #define SECPKG_ATTR_DCE_INFO        3
  292. #define SECPKG_ATTR_STREAM_SIZES    4
  293. #define SECPKG_ATTR_KEY_INFO        5
  294. #define SECPKG_ATTR_AUTHORITY       6
  295. #define SECPKG_ATTR_PROTO_INFO      7
  296. #define SECPKG_ATTR_PASSWORD_EXPIRY 8
  297. #define SECPKG_ATTR_SESSION_KEY     9
  298.  
  299. typedef struct _SecPkgContext_Sizes
  300. {
  301.     unsigned long cbMaxToken;
  302.     unsigned long cbMaxSignature;
  303.     unsigned long cbBlockSize;
  304.     unsigned long cbSecurityTrailer;
  305. } SecPkgContext_Sizes, SEC_FAR * PSecPkgContext_Sizes;
  306.  
  307. typedef struct _SecPkgContext_StreamSizes
  308. {
  309.     unsigned long   cbHeader;
  310.     unsigned long   cbTrailer;
  311.     unsigned long   cbMaximumMessage;
  312.     unsigned long   cBuffers;
  313.     unsigned long   cbBlockSize;
  314. } SecPkgContext_StreamSizes, * PSecPkgContext_StreamSizes;
  315.  
  316. typedef struct _SecPkgContext_NamesW
  317. {
  318.     SEC_WCHAR SEC_FAR * sUserName;
  319. } SecPkgContext_NamesW, SEC_FAR * PSecPkgContext_NamesW;
  320.  
  321. typedef struct _SecPkgContext_NamesA
  322. {
  323.     SEC_CHAR SEC_FAR * sUserName;
  324. } SecPkgContext_NamesA, SEC_FAR * PSecPkgContext_NamesA;
  325.  
  326. #ifdef UNICODE
  327. #define SecPkgContext_Names SecPkgContext_NamesW
  328. #define PSecPkgContext_Names PSecPkgContext_NamesW
  329. #else
  330. #define SecPkgContext_Names SecPkgContext_NamesA
  331. #define PSecPkgContext_Names PSecPkgContext_NamesA
  332. #endif // !UNICODE
  333.  
  334. typedef struct _SecPkgContext_Lifespan
  335. {
  336.     TimeStamp tsStart;
  337.     TimeStamp tsExpiry;
  338. } SecPkgContext_Lifespan, SEC_FAR * PSecPkgContext_Lifespan;
  339.  
  340. typedef struct _SecPkgContext_DceInfo
  341. {
  342.     unsigned long AuthzSvc;
  343.     void SEC_FAR * pPac;
  344. } SecPkgContext_DceInfo, SEC_FAR * PSecPkgContext_DceInfo;
  345.  
  346. typedef struct _SecPkgContext_KeyInfoA
  347. {
  348.     SEC_CHAR SEC_FAR *  sSignatureAlgorithmName;
  349.     SEC_CHAR SEC_FAR *  sEncryptAlgorithmName;
  350.     unsigned long       KeySize;
  351.     unsigned long       SignatureAlgorithm;
  352.     unsigned long       EncryptAlgorithm;
  353. } SecPkgContext_KeyInfoA, SEC_FAR * PSecPkgContext_KeyInfoA;
  354.  
  355. typedef struct _SecPkgContext_KeyInfoW
  356. {
  357.     SEC_WCHAR SEC_FAR * sSignatureAlgorithmName;
  358.     SEC_WCHAR SEC_FAR * sEncryptAlgorithmName;
  359.     unsigned long       KeySize;
  360.     unsigned long       SignatureAlgorithm;
  361.     unsigned long       EncryptAlgorithm;
  362. } SecPkgContext_KeyInfoW, SEC_FAR * PSecPkgContext_KeyInfoW;
  363.  
  364. #ifdef UNICODE
  365. #define SecPkgContext_KeyInfo SecPkgContext_KeyInfoW
  366. #define PSecPkgContext_KeyInfo PSecPkgContext_KeyInfoW
  367. #else
  368. #define SecPkgContext_KeyInfo SecPkgContext_KeyInfoA
  369. #define PSecPkgContext_KeyInfo PSecPkgContext_KeyInfoA
  370. #endif
  371.  
  372. typedef struct _SecPkgContext_AuthorityA
  373. {
  374.     SEC_CHAR SEC_FAR * sAuthorityName;
  375. } SecPkgContext_AuthorityA, * PSecPkgContext_AuthorityA;
  376.  
  377. typedef struct _SecPkgContext_AuthorityW
  378. {
  379.     SEC_WCHAR SEC_FAR * sAuthorityName;
  380. } SecPkgContext_AuthorityW, * PSecPkgContext_AuthorityW;
  381.  
  382. #ifdef UNICODE
  383. #define SecPkgContext_Authority SecPkgContext_AuthorityW
  384. #define PSecPkgContext_Authority PSecPkgContext_AuthorityW
  385. #else
  386. #define SecPkgContext_Authority SecPkgContext_AuthorityA
  387. #define PSecPkgContext_Authority PSecPkgContext_AuthorityA
  388. #endif
  389.  
  390. typedef struct _SecPkgContext_ProtoInfoA
  391. {
  392.     SEC_CHAR SEC_FAR *  sProtocolName;
  393.     unsigned long       majorVersion;
  394.     unsigned long       minorVersion;
  395. } SecPkgContext_ProtoInfoA, SEC_FAR * PSecPkgContext_ProtoInfoA;
  396.  
  397. typedef struct _SecPkgContext_ProtoInfoW
  398. {
  399.     SEC_WCHAR SEC_FAR * sProtocolName;
  400.     unsigned long       majorVersion;
  401.     unsigned long       minorVersion;
  402. } SecPkgContext_ProtoInfoW, SEC_FAR * PSecPkgContext_ProtoInfoW;
  403.  
  404. #ifdef UNICODE
  405. #define SecPkgContext_ProtoInfo SecPkgContext_ProtoInfoW
  406. #define PSecPkgContext_ProtoInfo PSecPkgContext_ProtoInfoW
  407. #else
  408. #define SecPkgContext_ProtoInfo SecPkgContext_ProtoInfoA
  409. #define PSecPkgContext_ProtoInfo PSecPkgContext_ProtoInfoA
  410. #endif
  411.  
  412. typedef struct _SecPkgContext_PasswordExpiry
  413. {
  414.     TimeStamp tsPasswordExpires;
  415. } SecPkgContext_PasswordExpiry, SEC_FAR * PSecPkgContext_PasswordExpiry;
  416.  
  417. typedef struct _SecPkgContext_SessionKey
  418. {
  419.     unsigned long SessionKeyLength;
  420.     unsigned char SEC_FAR * SessionKey;
  421. } SecPkgContext_SessionKey, * PSecPkgContext_SessionKey;
  422.  
  423.  
  424. #ifndef SECPKG_ATTR_ISSUER_LIST
  425. #define SECPKG_ATTR_ISSUER_LIST     0x50
  426. #define SECPKG_ATTR_REMOTE_CRED     0x51
  427. typedef struct _SecPkgContext_IssuerListInfo
  428. {
  429.     unsigned long           cbIssuerList;
  430.     unsigned char SEC_FAR * pIssuerList;
  431. }SecPkgContext_IssuerListInfo, *PSecPkgContext_IssuerListInfo;
  432.  
  433. typedef struct _SecPkgContext_RemoteCredentialInfo
  434. {
  435.     unsigned long           cbCertificateChain ;
  436.     unsigned char SEC_FAR * pbCertificateChain ;
  437.     unsigned long           cCertificates ;
  438.     unsigned long           fFlags ;
  439. }SecPkgContext_RemoteCredentialInfo, *PSecPkgContext_RemoteCredentialInfo;
  440. #endif
  441.  
  442. #ifdef UNDER_CE
  443.  
  444. //
  445. // The following definitions were
  446. // copies from rpcdce.h.
  447. //
  448. #define RPC_C_AUTHN_LEVEL_DEFAULT 0
  449. #define RPC_C_AUTHN_LEVEL_NONE 1
  450. #define RPC_C_AUTHN_LEVEL_CONNECT 2
  451. #define RPC_C_AUTHN_LEVEL_CALL 3
  452. #define RPC_C_AUTHN_LEVEL_PKT 4
  453. #define RPC_C_AUTHN_LEVEL_PKT_INTEGRITY 5
  454. #define RPC_C_AUTHN_LEVEL_PKT_PRIVACY 6
  455.  
  456. #define RPC_C_IMP_LEVEL_ANONYMOUS    1
  457. #define RPC_C_IMP_LEVEL_IDENTIFY     2
  458. #define RPC_C_IMP_LEVEL_IMPERSONATE  3
  459. #define RPC_C_IMP_LEVEL_DELEGATE     4
  460.  
  461. #define RPC_C_QOS_IDENTITY_STATIC    0
  462. #define RPC_C_QOS_IDENTITY_DYNAMIC   1
  463.  
  464. #define RPC_C_QOS_CAPABILITIES_DEFAULT     0
  465. #define RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH 1
  466.  
  467. #define RPC_C_PROTECT_LEVEL_DEFAULT       (RPC_C_AUTHN_LEVEL_DEFAULT)
  468. #define RPC_C_PROTECT_LEVEL_NONE          (RPC_C_AUTHN_LEVEL_NONE)
  469. #define RPC_C_PROTECT_LEVEL_CONNECT       (RPC_C_AUTHN_LEVEL_CONNECT)
  470. #define RPC_C_PROTECT_LEVEL_CALL          (RPC_C_AUTHN_LEVEL_CALL)
  471. #define RPC_C_PROTECT_LEVEL_PKT           (RPC_C_AUTHN_LEVEL_PKT)
  472. #define RPC_C_PROTECT_LEVEL_PKT_INTEGRITY (RPC_C_AUTHN_LEVEL_PKT_INTEGRITY)
  473. #define RPC_C_PROTECT_LEVEL_PKT_PRIVACY   (RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
  474.  
  475. #define RPC_C_AUTHN_NONE 0
  476. #define RPC_C_AUTHN_DCE_PRIVATE 1
  477. #define RPC_C_AUTHN_DCE_PUBLIC 2
  478. #define RPC_C_AUTHN_DEC_PUBLIC 4
  479. #define RPC_C_AUTHN_WINNT       10
  480. #define RPC_C_AUTHN_DEFAULT 0xFFFFFFFFL
  481.  
  482. #define RPC_C_SECURITY_QOS_VERSION  1L
  483.  
  484. typedef struct _RPC_SECURITY_QOS {
  485.   unsigned long Version;
  486.   unsigned long Capabilities;
  487.   unsigned long IdentityTracking;
  488.   unsigned long ImpersonationType;
  489. } RPC_SECURITY_QOS, *PRPC_SECURITY_QOS;
  490.  
  491. #define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1
  492. #define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2
  493.  
  494. typedef struct _SEC_WINNT_AUTH_IDENTITY {
  495.   LPWSTR        User;
  496.   unsigned long UserLength;
  497.   LPWSTR        Domain;
  498.   unsigned long DomainLength;
  499.   LPWSTR        Password;
  500.   unsigned long PasswordLength;
  501.   unsigned long Flags;
  502. } SEC_WINNT_AUTH_IDENTITY, *PSEC_WINNT_AUTH_IDENTITY;
  503.  
  504. #define RPC_C_AUTHZ_NONE 0
  505. #define RPC_C_AUTHZ_NAME 1
  506. #define RPC_C_AUTHZ_DCE 2
  507. //
  508. // End of definitions from rpcdce.h.
  509. //
  510. #endif // UNDER_CE
  511.  
  512. typedef void
  513. (SEC_ENTRY SEC_FAR * SEC_GET_KEY_FN) (
  514.     void SEC_FAR * Arg,                 // Argument passed in
  515.     void SEC_FAR * Principal,           // Principal ID
  516.     unsigned long KeyVer,               // Key Version
  517.     void SEC_FAR * SEC_FAR * Key,       // Returned ptr to key
  518.     SECURITY_STATUS SEC_FAR * Status    // returned status
  519.     );
  520.  
  521. SECURITY_STATUS SEC_ENTRY
  522. AcquireCredentialsHandleW(
  523.     SEC_WCHAR SEC_FAR * pszPrincipal,   // Name of principal
  524.     SEC_WCHAR SEC_FAR * pszPackage,     // Name of package
  525.     unsigned long fCredentialUse,       // Flags indicating use
  526.     void SEC_FAR * pvLogonId,           // Pointer to logon ID
  527.     void SEC_FAR * pAuthData,           // Package specific data
  528.     SEC_GET_KEY_FN pGetKeyFn,           // Pointer to GetKey() func
  529.     void SEC_FAR * pvGetKeyArgument,    // Value to pass to GetKey()
  530.     PCredHandle phCredential,           // (out) Cred Handle
  531.     PTimeStamp ptsExpiry                // (out) Lifetime (optional)
  532.     );
  533.  
  534. typedef SECURITY_STATUS
  535. (SEC_ENTRY * ACQUIRE_CREDENTIALS_HANDLE_FN_W)(
  536.     SEC_WCHAR SEC_FAR *,
  537.     SEC_WCHAR SEC_FAR *,
  538.     unsigned long,
  539.     void SEC_FAR *,
  540.     void SEC_FAR *,
  541.     SEC_GET_KEY_FN,
  542.     void SEC_FAR *,
  543.     PCredHandle,
  544.     PTimeStamp);
  545.  
  546. SECURITY_STATUS SEC_ENTRY
  547. AcquireCredentialsHandleA(
  548.     SEC_CHAR SEC_FAR * pszPrincipal,    // Name of principal
  549.     SEC_CHAR SEC_FAR * pszPackage,      // Name of package
  550.     unsigned long fCredentialUse,       // Flags indicating use
  551.     void SEC_FAR * pvLogonId,           // Pointer to logon ID
  552.     void SEC_FAR * pAuthData,           // Package specific data
  553.     SEC_GET_KEY_FN pGetKeyFn,           // Pointer to GetKey() func
  554.     void SEC_FAR * pvGetKeyArgument,    // Value to pass to GetKey()
  555.     PCredHandle phCredential,           // (out) Cred Handle
  556.     PTimeStamp ptsExpiry                // (out) Lifetime (optional)
  557.     );
  558.  
  559. typedef SECURITY_STATUS
  560. (SEC_ENTRY * ACQUIRE_CREDENTIALS_HANDLE_FN_A)(
  561.     SEC_CHAR SEC_FAR *,
  562.     SEC_CHAR SEC_FAR *,
  563.     unsigned long,
  564.     void SEC_FAR *,
  565.     void SEC_FAR *,
  566.     SEC_GET_KEY_FN,
  567.     void SEC_FAR *,
  568.     PCredHandle,
  569.     PTimeStamp);
  570.  
  571. #ifdef UNICODE
  572. #define AcquireCredentialsHandle AcquireCredentialsHandleW
  573. #define ACQUIRE_CREDENTIALS_HANDLE_FN ACQUIRE_CREDENTIALS_HANDLE_FN_W
  574. #else
  575. #define AcquireCredentialsHandle AcquireCredentialsHandleA
  576. #define ACQUIRE_CREDENTIALS_HANDLE_FN ACQUIRE_CREDENTIALS_HANDLE_FN_A
  577. #endif // !UNICODE
  578.  
  579. SECURITY_STATUS SEC_ENTRY
  580. FreeCredentialsHandle(
  581.     PCredHandle phCredential            // Handle to free
  582.     );
  583.  
  584. typedef SECURITY_STATUS
  585. (SEC_ENTRY * FREE_CREDENTIALS_HANDLE_FN)(
  586.     PCredHandle );
  587.  
  588. ////////////////////////////////////////////////////////////////////////
  589. ///
  590. /// Context Management Functions
  591. ///
  592. ////////////////////////////////////////////////////////////////////////
  593.  
  594. SECURITY_STATUS SEC_ENTRY
  595. InitializeSecurityContextW(
  596.     PCredHandle phCredential,               // Cred to base context
  597.     PCtxtHandle phContext,                  // Existing context (OPT)
  598.     SEC_WCHAR SEC_FAR * pszTargetName,      // Name of target
  599.     unsigned long fContextReq,              // Context Requirements
  600.     unsigned long Reserved1,                // Reserved, MBZ
  601.     unsigned long TargetDataRep,            // Data rep of target
  602.     PSecBufferDesc pInput,                  // Input Buffers
  603.     unsigned long Reserved2,                // Reserved, MBZ
  604.     PCtxtHandle phNewContext,               // (out) New Context handle
  605.     PSecBufferDesc pOutput,                 // (inout) Output Buffers
  606.     unsigned long SEC_FAR * pfContextAttr,  // (out) Context attrs
  607.     PTimeStamp ptsExpiry                    // (out) Life span (OPT)
  608.     );
  609.  
  610. typedef SECURITY_STATUS
  611. (SEC_ENTRY * INITIALIZE_SECURITY_CONTEXT_FN_W)(
  612.     PCredHandle,
  613.     PCtxtHandle,
  614.     SEC_WCHAR SEC_FAR *,
  615.     unsigned long,
  616.     unsigned long,
  617.     unsigned long,
  618.     PSecBufferDesc,
  619.     unsigned long,
  620.     PCtxtHandle,
  621.     PSecBufferDesc,
  622.     unsigned long SEC_FAR *,
  623.     PTimeStamp);
  624.  
  625. SECURITY_STATUS SEC_ENTRY
  626. InitializeSecurityContextA(
  627.     PCredHandle phCredential,               // Cred to base context
  628.     PCtxtHandle phContext,                  // Existing context (OPT)
  629.     SEC_CHAR SEC_FAR * pszTargetName,       // Name of target
  630.     unsigned long fContextReq,              // Context Requirements
  631.     unsigned long Reserved1,                // Reserved, MBZ
  632.     unsigned long TargetDataRep,            // Data rep of target
  633.     PSecBufferDesc pInput,                  // Input Buffers
  634.     unsigned long Reserved2,                // Reserved, MBZ
  635.     PCtxtHandle phNewContext,               // (out) New Context handle
  636.     PSecBufferDesc pOutput,                 // (inout) Output Buffers
  637.     unsigned long SEC_FAR * pfContextAttr,  // (out) Context attrs
  638.     PTimeStamp ptsExpiry                    // (out) Life span (OPT)
  639.     );
  640.  
  641. typedef SECURITY_STATUS
  642. (SEC_ENTRY * INITIALIZE_SECURITY_CONTEXT_FN_A)(
  643.     PCredHandle,
  644.     PCtxtHandle,
  645.     SEC_CHAR SEC_FAR *,
  646.     unsigned long,
  647.     unsigned long,
  648.     unsigned long,
  649.     PSecBufferDesc,
  650.     unsigned long,
  651.     PCtxtHandle,
  652.     PSecBufferDesc,
  653.     unsigned long SEC_FAR *,
  654.     PTimeStamp);
  655.  
  656. #ifdef UNICODE
  657. #define InitializeSecurityContext InitializeSecurityContextW
  658. #define INITIALIZE_SECURITY_CONTEXT_FN INITIALIZE_SECURITY_CONTEXT_FN_W
  659. #else
  660. #define InitializeSecurityContext InitializeSecurityContextA
  661. #define INITIALIZE_SECURITY_CONTEXT_FN INITIALIZE_SECURITY_CONTEXT_FN_A
  662. #endif // !UNICODE
  663.  
  664. SECURITY_STATUS SEC_ENTRY
  665. AcceptSecurityContext(
  666.     PCredHandle phCredential,               // Cred to base context
  667.     PCtxtHandle phContext,                  // Existing context (OPT)
  668.     PSecBufferDesc pInput,                  // Input buffer
  669.     unsigned long fContextReq,              // Context Requirements
  670.     unsigned long TargetDataRep,            // Target Data Rep
  671.     PCtxtHandle phNewContext,               // (out) New context handle
  672.     PSecBufferDesc pOutput,                 // (inout) Output buffers
  673.     unsigned long SEC_FAR * pfContextAttr,  // (out) Context attributes
  674.     PTimeStamp ptsExpiry                    // (out) Life span (OPT)
  675.     );
  676.  
  677. typedef SECURITY_STATUS
  678. (SEC_ENTRY * ACCEPT_SECURITY_CONTEXT_FN)(
  679.     PCredHandle,
  680.     PCtxtHandle,
  681.     PSecBufferDesc,
  682.     unsigned long,
  683.     unsigned long,
  684.     PCtxtHandle,
  685.     PSecBufferDesc,
  686.     unsigned long SEC_FAR *,
  687.     PTimeStamp);
  688.  
  689. SECURITY_STATUS SEC_ENTRY
  690. CompleteAuthToken(
  691.     PCtxtHandle phContext,              // Context to complete
  692.     PSecBufferDesc pToken               // Token to complete
  693.     );
  694.  
  695. typedef SECURITY_STATUS
  696. (SEC_ENTRY * COMPLETE_AUTH_TOKEN_FN)(
  697.     PCtxtHandle,
  698.     PSecBufferDesc);
  699.  
  700. SECURITY_STATUS SEC_ENTRY
  701. ImpersonateSecurityContext(
  702.     PCtxtHandle phContext               // Context to impersonate
  703.     );
  704.  
  705. typedef SECURITY_STATUS
  706. (SEC_ENTRY * IMPERSONATE_SECURITY_CONTEXT_FN)(
  707.     PCtxtHandle);
  708.  
  709. SECURITY_STATUS SEC_ENTRY
  710. RevertSecurityContext(
  711.     PCtxtHandle phContext               // Context from which to re
  712.     );
  713.  
  714. typedef SECURITY_STATUS
  715. (SEC_ENTRY * REVERT_SECURITY_CONTEXT_FN)(
  716.     PCtxtHandle);
  717.  
  718. SECURITY_STATUS SEC_ENTRY
  719. QuerySecurityContextToken(
  720.     PCtxtHandle phContext,
  721.     void SEC_FAR * SEC_FAR * Token
  722.     );
  723.  
  724. typedef SECURITY_STATUS
  725. (SEC_ENTRY * QUERY_SECURITY_CONTEXT_TOKEN_FN)(
  726.     PCtxtHandle, void SEC_FAR * SEC_FAR *);
  727.  
  728. SECURITY_STATUS SEC_ENTRY
  729. DeleteSecurityContext(
  730.     PCtxtHandle phContext               // Context to delete
  731.     );
  732.  
  733. typedef SECURITY_STATUS
  734. (SEC_ENTRY * DELETE_SECURITY_CONTEXT_FN)(
  735.     PCtxtHandle);
  736.  
  737. SECURITY_STATUS SEC_ENTRY
  738. ApplyControlToken(
  739.     PCtxtHandle phContext,              // Context to modify
  740.     PSecBufferDesc pInput               // Input token to apply
  741.     );
  742.  
  743. typedef SECURITY_STATUS
  744. (SEC_ENTRY * APPLY_CONTROL_TOKEN_FN)(
  745.     PCtxtHandle, PSecBufferDesc);
  746.  
  747. SECURITY_STATUS SEC_ENTRY
  748. QueryContextAttributesW(
  749.     PCtxtHandle phContext,              // Context to query
  750.     unsigned long ulAttribute,          // Attribute to query
  751.     void SEC_FAR * pBuffer              // Buffer for attributes
  752.     );
  753.  
  754. typedef SECURITY_STATUS
  755. (SEC_ENTRY * QUERY_CONTEXT_ATTRIBUTES_FN_W)(
  756.     PCtxtHandle,
  757.     unsigned long,
  758.     void SEC_FAR *);
  759.  
  760. SECURITY_STATUS SEC_ENTRY
  761. QueryContextAttributesA(
  762.     PCtxtHandle phContext,              // Context to query
  763.     unsigned long ulAttribute,          // Attribute to query
  764.     void SEC_FAR * pBuffer              // Buffer for attributes
  765.     );
  766.  
  767. typedef SECURITY_STATUS
  768. (SEC_ENTRY * QUERY_CONTEXT_ATTRIBUTES_FN_A)(
  769.     PCtxtHandle,
  770.     unsigned long,
  771.     void SEC_FAR *);
  772.  
  773. #ifdef UNICODE
  774. #define QueryContextAttributes QueryContextAttributesW
  775. #define QUERY_CONTEXT_ATTRIBUTES_FN QUERY_CONTEXT_ATTRIBUTES_FN_W
  776. #else
  777. #define QueryContextAttributes QueryContextAttributesA
  778. #define QUERY_CONTEXT_ATTRIBUTES_FN QUERY_CONTEXT_ATTRIBUTES_FN_A
  779. #endif // !UNICODE
  780.  
  781. SECURITY_STATUS SEC_ENTRY
  782. QueryCredentialsAttributesW(
  783.     PCredHandle phCredential,           // Credential to query
  784.     unsigned long ulAttribute,          // Attribute to query
  785.     void SEC_FAR * pBuffer              // Buffer for attributes
  786.     );
  787.  
  788. typedef SECURITY_STATUS
  789. (SEC_ENTRY * QUERY_CREDENTIALS_ATTRIBUTES_FN_W)(
  790.     PCredHandle,
  791.     unsigned long,
  792.     void SEC_FAR *);
  793.  
  794. SECURITY_STATUS SEC_ENTRY
  795. QueryCredentialsAttributesA(
  796.     PCredHandle phCredential,           // Credential to query
  797.     unsigned long ulAttribute,          // Attribute to query
  798.     void SEC_FAR * pBuffer              // Buffer for attributes
  799.     );
  800.  
  801. typedef SECURITY_STATUS
  802. (SEC_ENTRY * QUERY_CREDENTIALS_ATTRIBUTES_FN_A)(
  803.     PCredHandle,
  804.     unsigned long,
  805.     void SEC_FAR *);
  806.  
  807. #ifdef UNICODE
  808. #define QueryCredentialsAttributes QueryCredentialsAttributesW
  809. #define QUERY_CREDENTIALS_ATTRIBUTES_FN QUERY_CREDENTIALS_ATTRIBUTES_FN_W
  810. #else
  811. #define QueryCredentialsAttributes QueryCredentialsAttributesA
  812. #define QUERY_CREDENTIALS_ATTRIBUTES_FN QUERY_CREDENTIALS_ATTRIBUTES_FN_A
  813. #endif // !UNICODE
  814.  
  815. SECURITY_STATUS SEC_ENTRY
  816. FreeContextBuffer(
  817.     void SEC_FAR * pvContextBuffer              // buffer to free
  818.     );
  819.  
  820. typedef SECURITY_STATUS
  821. (SEC_ENTRY * FREE_CONTEXT_BUFFER_FN)(
  822.     void SEC_FAR *);
  823.  
  824. ///////////////////////////////////////////////////////////////////
  825. ////
  826. ////    Message Support API
  827. ////
  828. //////////////////////////////////////////////////////////////////
  829.  
  830. SECURITY_STATUS SEC_ENTRY
  831. MakeSignature(
  832.     PCtxtHandle phContext,              // Context to use
  833.     unsigned long fQOP,                 // Quality of Protection
  834.     PSecBufferDesc pMessage,            // Message to sign
  835.     unsigned long MessageSeqNo          // Message Sequence Num.
  836.     );
  837.  
  838. typedef SECURITY_STATUS
  839. (SEC_ENTRY * MAKE_SIGNATURE_FN)(
  840.     PCtxtHandle,
  841.     unsigned long,
  842.     PSecBufferDesc,
  843.     unsigned long);
  844.  
  845. SECURITY_STATUS SEC_ENTRY
  846. VerifySignature(
  847.     PCtxtHandle phContext,              // Context to use
  848.     PSecBufferDesc pMessage,            // Message to verify
  849.     unsigned long MessageSeqNo,         // Sequence Num.
  850.     unsigned long SEC_FAR * pfQOP               // QOP used
  851.     );
  852.  
  853. typedef SECURITY_STATUS
  854. (SEC_ENTRY * VERIFY_SIGNATURE_FN)(
  855.     PCtxtHandle,
  856.     PSecBufferDesc,
  857.     unsigned long,
  858.     unsigned long SEC_FAR *);
  859.  
  860. SECURITY_STATUS SEC_ENTRY
  861. EncryptMessage( PCtxtHandle         phContext,
  862.                 unsigned long       fQOP,
  863.                 PSecBufferDesc      pMessage,
  864.                 unsigned long       MessageSeqNo);
  865.  
  866. typedef SECURITY_STATUS
  867. (SEC_ENTRY * ENCRYPT_MESSAGE_FN)(
  868.     PCtxtHandle, unsigned long, PSecBufferDesc, unsigned long);
  869.  
  870.  
  871. SECURITY_STATUS SEC_ENTRY
  872. DecryptMessage( PCtxtHandle         phContext,
  873.                 PSecBufferDesc      pMessage,
  874.                 unsigned long       MessageSeqNo,
  875.                 unsigned long *     pfQOP);
  876.  
  877.  
  878. typedef SECURITY_STATUS
  879. (SEC_ENTRY * DECRYPT_MESSAGE_FN)(
  880.     PCtxtHandle, PSecBufferDesc, unsigned long,
  881.     unsigned long SEC_FAR *);
  882.  
  883. ///////////////////////////////////////////////////////////////////////////
  884. ////
  885. ////    Misc.
  886. ////
  887. ///////////////////////////////////////////////////////////////////////////
  888.  
  889. SECURITY_STATUS SEC_ENTRY
  890. EnumerateSecurityPackagesW(
  891.     unsigned long SEC_FAR * pcPackages,     // Receives num. packages
  892.     PSecPkgInfoW SEC_FAR * ppPackageInfo    // Receives array of info
  893.     );
  894.  
  895. typedef SECURITY_STATUS
  896. (SEC_ENTRY * ENUMERATE_SECURITY_PACKAGES_FN_W)(
  897.     unsigned long SEC_FAR *,
  898.     PSecPkgInfoW SEC_FAR *);
  899.  
  900. SECURITY_STATUS SEC_ENTRY
  901. EnumerateSecurityPackagesA(
  902.     unsigned long SEC_FAR * pcPackages,     // Receives num. packages
  903.     PSecPkgInfoA SEC_FAR * ppPackageInfo    // Receives array of info
  904.     );
  905.  
  906. typedef SECURITY_STATUS
  907. (SEC_ENTRY * ENUMERATE_SECURITY_PACKAGES_FN_A)(
  908.     unsigned long SEC_FAR *,
  909.     PSecPkgInfoA SEC_FAR *);
  910.  
  911. #ifdef UNICODE
  912. #define EnumerateSecurityPackages EnumerateSecurityPackagesW
  913. #define ENUMERATE_SECURITY_PACKAGES_FN ENUMERATE_SECURITY_PACKAGES_FN_W
  914. #else
  915. #define EnumerateSecurityPackages EnumerateSecurityPackagesA
  916. #define ENUMERATE_SECURITY_PACKAGES_FN ENUMERATE_SECURITY_PACKAGES_FN_A
  917. #endif // !UNICODE
  918.  
  919. SECURITY_STATUS SEC_ENTRY
  920. QuerySecurityPackageInfoW(
  921.     SEC_WCHAR SEC_FAR * pszPackageName,     // Name of package
  922.     PSecPkgInfoW SEC_FAR *ppPackageInfo     // Receives package info
  923.     );
  924.  
  925. typedef SECURITY_STATUS
  926. (SEC_ENTRY * QUERY_SECURITY_PACKAGE_INFO_FN_W)(
  927.     SEC_WCHAR SEC_FAR *,
  928.     PSecPkgInfoW SEC_FAR *);
  929.  
  930. SECURITY_STATUS SEC_ENTRY
  931. QuerySecurityPackageInfoA(
  932.     SEC_CHAR SEC_FAR * pszPackageName,     // Name of package
  933.     PSecPkgInfoA SEC_FAR *ppPackageInfo     // Receives package info
  934.     );
  935.  
  936. typedef SECURITY_STATUS
  937. (SEC_ENTRY * QUERY_SECURITY_PACKAGE_INFO_FN_A)(
  938.     SEC_CHAR SEC_FAR *,
  939.     PSecPkgInfoA SEC_FAR *);
  940.  
  941. #ifdef UNICODE
  942. #define QuerySecurityPackageInfo QuerySecurityPackageInfoW
  943. #define QUERY_SECURITY_PACKAGE_INFO_FN QUERY_SECURITY_PACKAGE_INFO_FN_W
  944. #else
  945. #define QuerySecurityPackageInfo QuerySecurityPackageInfoA
  946. #define QUERY_SECURITY_PACKAGE_INFO_FN QUERY_SECURITY_PACKAGE_INFO_FN_A
  947. #endif // !UNICODE
  948.  
  949. typedef enum _SecDelegationType {
  950.     SecFull,
  951.     SecService,
  952.     SecTree,
  953.     SecDirectory,
  954.     SecObject
  955. } SecDelegationType, * PSecDelegationType;
  956.  
  957. SECURITY_STATUS SEC_ENTRY
  958. DelegateSecurityContext(
  959.     PCtxtHandle         phContext,          // IN Active context to delegate
  960.     LPWSTR              pszTarget,
  961.     SecDelegationType   DelegationType,     // IN Type of delegation
  962.     PTimeStamp          pExpiry,            // IN OPTIONAL time limit
  963.     PSecBuffer          pPackageParameters, // IN OPTIONAL package specific
  964.     PSecBufferDesc      pOutput);           // OUT Token for applycontroltoken.
  965.  
  966. ///////////////////////////////////////////////////////////////////////////
  967. ////
  968. ////    Proxies
  969. ////
  970. ///////////////////////////////////////////////////////////////////////////
  971.  
  972. //
  973. // Proxies are only available on NT platforms
  974. //
  975.  
  976. ///////////////////////////////////////////////////////////////////////////////
  977. ////
  978. ////  Fast access for RPC:
  979. ////
  980. ///////////////////////////////////////////////////////////////////////////////
  981.  
  982. #define SECURITY_ENTRYPOINTW SEC_TEXT("InitSecurityInterfaceW")
  983. #define SECURITY_ENTRYPOINTA SEC_TEXT("InitSecurityInterfaceA")
  984.  
  985. #ifdef UNICODE
  986. #define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINTW
  987. #else // UNICODE
  988. #define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINTA
  989. #endif // UNICODE
  990.  
  991. typedef struct _SECURITY_FUNCTION_TABLE_W {
  992.     unsigned long                       dwVersion;
  993.     ENUMERATE_SECURITY_PACKAGES_FN_W    EnumerateSecurityPackagesW;
  994.     QUERY_CREDENTIALS_ATTRIBUTES_FN_W   QueryCredentialsAttributesW;
  995.     ACQUIRE_CREDENTIALS_HANDLE_FN_W     AcquireCredentialsHandleW;
  996.     FREE_CREDENTIALS_HANDLE_FN          FreeCredentialHandle;
  997.     void SEC_FAR *                      Reserved2;
  998.     INITIALIZE_SECURITY_CONTEXT_FN_W    InitializeSecurityContextW;
  999.     ACCEPT_SECURITY_CONTEXT_FN          AcceptSecurityContext;
  1000.     COMPLETE_AUTH_TOKEN_FN              CompleteAuthToken;
  1001.     DELETE_SECURITY_CONTEXT_FN          DeleteSecurityContext;
  1002.     APPLY_CONTROL_TOKEN_FN              ApplyControlToken;
  1003.     QUERY_CONTEXT_ATTRIBUTES_FN_W       QueryContextAttributesW;
  1004.     IMPERSONATE_SECURITY_CONTEXT_FN     ImpersonateSecurityContext;
  1005.     REVERT_SECURITY_CONTEXT_FN          RevertSecurityContext;
  1006.     MAKE_SIGNATURE_FN                   MakeSignature;
  1007.     VERIFY_SIGNATURE_FN                 VerifySignature;
  1008.     FREE_CONTEXT_BUFFER_FN              FreeContextBuffer;
  1009.     QUERY_SECURITY_PACKAGE_INFO_FN_W    QuerySecurityPackageInfoW;
  1010.     void SEC_FAR *                      Reserved3;
  1011.     void SEC_FAR *                      Reserved4;
  1012.     void SEC_FAR *                      Reserved5;
  1013.     void SEC_FAR *                      Reserved6;
  1014.     void SEC_FAR *                      Reserved7;
  1015.     void SEC_FAR *                      Reserved8;
  1016.     QUERY_SECURITY_CONTEXT_TOKEN_FN     QuerySecurityContextToken;
  1017.     ENCRYPT_MESSAGE_FN                  EncryptMessage;
  1018.     DECRYPT_MESSAGE_FN                  DecryptMessage;
  1019. } SecurityFunctionTableW, SEC_FAR * PSecurityFunctionTableW;
  1020.  
  1021. typedef struct _SECURITY_FUNCTION_TABLE_A {
  1022.     unsigned long                       dwVersion;
  1023.     ENUMERATE_SECURITY_PACKAGES_FN_A    EnumerateSecurityPackagesA;
  1024.     QUERY_CREDENTIALS_ATTRIBUTES_FN_A   QueryCredentialsAttributesA;
  1025.     ACQUIRE_CREDENTIALS_HANDLE_FN_A     AcquireCredentialsHandleA;
  1026.     FREE_CREDENTIALS_HANDLE_FN          FreeCredentialHandle;
  1027.     void SEC_FAR *                      Reserved2;
  1028.     INITIALIZE_SECURITY_CONTEXT_FN_A    InitializeSecurityContextA;
  1029.     ACCEPT_SECURITY_CONTEXT_FN          AcceptSecurityContext;
  1030.     COMPLETE_AUTH_TOKEN_FN              CompleteAuthToken;
  1031.     DELETE_SECURITY_CONTEXT_FN          DeleteSecurityContext;
  1032.     APPLY_CONTROL_TOKEN_FN              ApplyControlToken;
  1033.     QUERY_CONTEXT_ATTRIBUTES_FN_A       QueryContextAttributesA;
  1034.     IMPERSONATE_SECURITY_CONTEXT_FN     ImpersonateSecurityContext;
  1035.     REVERT_SECURITY_CONTEXT_FN          RevertSecurityContext;
  1036.     MAKE_SIGNATURE_FN                   MakeSignature;
  1037.     VERIFY_SIGNATURE_FN                 VerifySignature;
  1038.     FREE_CONTEXT_BUFFER_FN              FreeContextBuffer;
  1039.     QUERY_SECURITY_PACKAGE_INFO_FN_A    QuerySecurityPackageInfoA;
  1040.     void SEC_FAR *                      Reserved3;
  1041.     void SEC_FAR *                      Reserved4;
  1042.     void SEC_FAR *                      Reserved5;
  1043.     void SEC_FAR *                      Reserved6;
  1044.     void SEC_FAR *                      Reserved7;
  1045.     void SEC_FAR *                      Reserved8;
  1046.     QUERY_SECURITY_CONTEXT_TOKEN_FN     QuerySecurityContextToken;
  1047.     ENCRYPT_MESSAGE_FN                  EncryptMessage;
  1048.     DECRYPT_MESSAGE_FN                  DecryptMessage;
  1049. } SecurityFunctionTableA, SEC_FAR * PSecurityFunctionTableA;
  1050.  
  1051. #ifdef UNICODE
  1052. #define SecurityFunctionTable SecurityFunctionTableW
  1053. #define PSecurityFunctionTable PSecurityFunctionTableW
  1054. #else
  1055. #define SecurityFunctionTable SecurityFunctionTableA
  1056. #define PSecurityFunctionTable PSecurityFunctionTableA
  1057. #endif // !UNICODE
  1058.  
  1059. #define SECURITY_
  1060.  
  1061. #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION     1
  1062.  
  1063. PSecurityFunctionTableA SEC_ENTRY
  1064. InitSecurityInterfaceA(
  1065.     void
  1066.     );
  1067.  
  1068. typedef PSecurityFunctionTableA
  1069. (SEC_ENTRY * INIT_SECURITY_INTERFACE_A)(void);
  1070.  
  1071. PSecurityFunctionTableW SEC_ENTRY
  1072. InitSecurityInterfaceW(
  1073.     void
  1074.     );
  1075.  
  1076. typedef PSecurityFunctionTableW
  1077. (SEC_ENTRY * INIT_SECURITY_INTERFACE_W)(void);
  1078.  
  1079. #ifdef UNICODE
  1080. #define InitSecurityInterface InitSecurityInterfaceW
  1081. #define INIT_SECURITY_INTERFACE INIT_SECURITY_INTERFACE_W
  1082. #else
  1083. #define InitSecurityInterface InitSecurityInterfaceA
  1084. #define INIT_SECURITY_INTERFACE INIT_SECURITY_INTERFACE_A
  1085. #endif // !UNICODE
  1086.  
  1087. typedef struct _SECURITY_PACKAGE_OPTIONS {
  1088.     unsigned long   Size;
  1089.     unsigned long   Type;
  1090.     unsigned long   Flags;
  1091.     unsigned long   SignatureSize;
  1092.     void SEC_FAR *  Signature;
  1093. } SECURITY_PACKAGE_OPTIONS, SEC_FAR * PSECURITY_PACKAGE_OPTIONS;
  1094.  
  1095. #define SECPKG_OPTIONS_TYPE_UNKNOWN 0
  1096. #define SECPKG_OPTIONS_TYPE_LSA     1
  1097. #define SECPKG_OPTIONS_TYPE_SSPI    2
  1098.  
  1099. #define SECPKG_OPTIONS_PERMANENT    0x00000001
  1100.  
  1101. SECURITY_STATUS
  1102. SEC_ENTRY
  1103. AddSecurityPackageA(
  1104.     SEC_CHAR SEC_FAR * pszPackageName,
  1105.     SECURITY_PACKAGE_OPTIONS SEC_FAR * Options
  1106.     );
  1107.  
  1108. SECURITY_STATUS
  1109. SEC_ENTRY
  1110. AddSecurityPackageW(
  1111.     SEC_WCHAR SEC_FAR * pszPackageName,
  1112.     SECURITY_PACKAGE_OPTIONS SEC_FAR * Options
  1113.     );
  1114.  
  1115. #ifdef UNICODE
  1116. #define AddSecurityPackage AddSecurityPackageW
  1117. #else
  1118. #define AddSecurityPackage AddSecurityPackageA
  1119. #endif
  1120.  
  1121. SECURITY_STATUS
  1122. SEC_ENTRY
  1123. DeleteSecurityPackageA(
  1124.     SEC_CHAR SEC_FAR * pszPackageName );
  1125.  
  1126. SECURITY_STATUS
  1127. SEC_ENTRY
  1128. DeleteSecurityPackageW(
  1129.     SEC_WCHAR SEC_FAR * pszPackageName );
  1130.  
  1131. #ifdef UNICODE
  1132. #define DeleteSecurityPackage DeleteSecurityPackageW
  1133. #else
  1134. #define DeleteSecurityPackage DeleteSecurityPackageA
  1135. #endif
  1136.  
  1137. #endif // __SSPI_H__
  1138.